| @@ -464,7 +464,11 @@ def activity_signin(request): | ||
| 464 | 464 |  | 
| 465 | 465 | def get_group_share_info_integral(activity_id, share_user_id, open_gid, group_share_integral, group_share_max_integral): | 
| 466 | 466 | # 校验该分享人是否已领取该群积分 | 
| 467 | - has_integral = MemberActivityGroupShareInfo.objects.filter(activity_id=activity_id, share_user_id=share_user_id, open_gid=open_gid, is_integral=True).exists() | |
| 467 | + if open_gid: | |
| 468 | + has_integral = MemberActivityGroupShareInfo.objects.filter(activity_id=activity_id, share_user_id=share_user_id, open_gid=open_gid, is_integral=True).exists() | |
| 469 | + else: | |
| 470 | + has_integral = MemberActivityGroupShareInfo.objects.filter(activity_id=activity_id, share_user_id=share_user_id, is_integral=True).exists() | |
| 471 | + | |
| 468 | 472 | if has_integral: | 
| 469 | 473 | return False, 0 | 
| 470 | 474 | # 校验该分享人是否已领取该活动积分上限 | 
| @@ -485,20 +489,22 @@ def activity_group_share(request): | ||
| 485 | 489 |      iv = request.POST.get('iv', '') | 
| 486 | 490 |      encryptedData = request.POST.get('encryptedData', '') | 
| 487 | 491 |  | 
| 488 | -    wxcfg = WECHAT.get('MINIAPP', {}) | |
| 492 | + open_gid = None | |
| 493 | + if iv and encryptedData: | |
| 494 | +        wxcfg = WECHAT.get('MINIAPP', {}) | |
| 489 | 495 |  | 
| 490 | -    appid = wxcfg.get('appID') | |
| 491 | -    secret = wxcfg.get('appsecret') | |
| 496 | +        appid = wxcfg.get('appID') | |
| 497 | +        secret = wxcfg.get('appsecret') | |
| 492 | 498 |  | 
| 493 | -    # { | |
| 494 | - # "openGId": "OPENGID" | |
| 495 | - # } | |
| 496 | - shareinfo = get_shareinfo(appid=appid, secret=secret, unid=click_user_id, session_key=None, encryptedData=encryptedData, iv=iv, storage=RedisStorage(r)) | |
| 499 | +        # { | |
| 500 | + # "openGId": "OPENGID" | |
| 501 | + # } | |
| 502 | + shareinfo = get_shareinfo(appid=appid, secret=secret, unid=click_user_id, session_key=None, encryptedData=encryptedData, iv=iv, storage=RedisStorage(r)) | |
| 497 | 503 |  | 
| 498 | -    open_gid = shareinfo.get('openGId') | |
| 504 | +        open_gid = shareinfo.get('openGId') | |
| 499 | 505 |  | 
| 500 | - if not open_gid: | |
| 501 | - return response() | |
| 506 | + if not open_gid: | |
| 507 | + return response() | |
| 502 | 508 |  | 
| 503 | 509 | try: | 
| 504 | 510 | user = UserInfo.objects.select_for_update().get(user_id=share_user_id, status=True) | 
| @@ -0,0 +1,18 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 3.2.16 on 2022-11-11 04:42 | |
| 3 | + | |
| 4 | +from django.db import migrations | |
| 5 | + | |
| 6 | + | |
| 7 | +class Migration(migrations.Migration): | |
| 8 | + | |
| 9 | + dependencies = [ | |
| 10 | +        ('member', '0052_auto_20221107_2238'), | |
| 11 | + ] | |
| 12 | + | |
| 13 | + operations = [ | |
| 14 | + migrations.AlterUniqueTogether( | |
| 15 | + name='memberactivitygroupshareinfo', | |
| 16 | +            unique_together={('activity_id', 'share_user_id', 'click_user_id', 'brand_id')}, | |
| 17 | + ), | |
| 18 | + ] | 
| @@ -711,7 +711,7 @@ class MemberActivityGroupShareInfo(BaseModelMixin, BrandInfoMixin): | ||
| 711 | 711 | verbose_name_plural = _(u'会员活动群组分享信息') | 
| 712 | 712 |  | 
| 713 | 713 | unique_together = ( | 
| 714 | -            ('activity_id', 'share_user_id', 'click_user_id', 'open_gid', 'brand_id'), | |
| 714 | +            ('activity_id', 'share_user_id', 'click_user_id', 'brand_id'), | |
| 715 | 715 | ) | 
| 716 | 716 |  | 
| 717 | 717 | def __unicode__(self): |